Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Get Instance Attributes #477

Merged
merged 7 commits into from
Dec 2, 2023
Merged

ENH: Get Instance Attributes #477

merged 7 commits into from
Dec 2, 2023

Conversation

MateusStano
Copy link
Member

@MateusStano MateusStano commented Nov 21, 2023

Pull request type

  • Code changes (bugfix, features)
  • Code maintenance (refactoring, formatting, tests)
  • ReadMe, Docs and GitHub updates
  • Other (please describe):

Checklist

  • Tests for the changes have been added (if needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest --runslow) have passed locally

Description

This PR introduces a function to utilities.py that returns all relevant attributes of all main classes in RocketPy. This is a special request for the development of the Infinity-API.

I have also added a deprecation warning to the old info_returned methods, since they do not need to be used anymore

Breaking change

  • Yes
  • No

Additional information

There a couple of fixes here to the Environment.time_array attribute. In some atmospheric models, this was not being saved as an array, but instead as a NetCDF4 object. This attribute is not used anywhere in the code, but it was breaking the get_instance_attributes function

@MateusStano MateusStano added the Enhancement New feature or request, including adjustments in current codes label Nov 21, 2023
@MateusStano MateusStano self-assigned this Nov 21, 2023
@MateusStano
Copy link
Member Author

@GabrielBarberini @luimot A review from you guys is extra important!

Please tell me if this works well with the API

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (beb22ab) 71.05% compared to head (b27edc3) 71.16%.
Report is 3 commits behind head on develop.

Files Patch % Lines
rocketpy/environment/environment.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #477      +/-   ##
===========================================
+ Coverage    71.05%   71.16%   +0.10%     
===========================================
  Files           55       55              
  Lines         9262     9272      +10     
===========================================
+ Hits          6581     6598      +17     
+ Misses        2681     2674       -7     
Flag Coverage Δ
unittests 71.16% <91.66%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@GabrielBarberini GabrielBarberini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

rocketpy/utilities.py Show resolved Hide resolved
rocketpy/environment/environment.py Show resolved Hide resolved
rocketpy/environment/environment.py Outdated Show resolved Hide resolved
rocketpy/utilities.py Show resolved Hide resolved
rocketpy/utilities.py Show resolved Hide resolved
@Gui-FernandesBR Gui-FernandesBR linked an issue Nov 23, 2023 that may be closed by this pull request
@Gui-FernandesBR Gui-FernandesBR removed the request for review from luimot November 29, 2023 21:41
@MateusStano MateusStano merged commit feb3299 into develop Dec 2, 2023
13 checks passed
@MateusStano MateusStano deleted the enh/get-attributes branch December 2, 2023 14:46
MateusStano added a commit that referenced this pull request Dec 2, 2023
commit 7722736
Merge: feb3299 62c8bb6
Author: MateusStano <[email protected]>
Date:   Sat Dec 2 11:54:10 2023 -0300

    Merge pull request #494 from RocketPy-Team/tst/testing-refactor

    TST: solid_motor.py testing refactors

commit feb3299
Merge: a9ac31c b27edc3
Author: MateusStano <[email protected]>
Date:   Sat Dec 2 11:46:54 2023 -0300

    Merge pull request #477 from RocketPy-Team/enh/get-attributes

    ENH: Get Instance Attributes

commit b27edc3
Author: MateusStano <[email protected]>
Date:   Wed Nov 29 19:01:32 2023 +0100

    TST: add test

commit dcdd6bd
Merge: 438f4c0 191ab9f
Author: MateusStano <[email protected]>
Date:   Wed Nov 29 18:04:31 2023 +0100

    Merge remote-tracking branch 'origin/develop' into enh/get-attributes

commit 438f4c0
Author: MateusStano <[email protected]>
Date:   Wed Nov 29 17:44:19 2023 +0100

    MNT: improve warnings

commit 62c8bb6
Author: Lint Action <[email protected]>
Date:   Wed Nov 29 03:39:29 2023 +0000

    Fix code style issues with Black

commit 0180755
Author: Lucas <[email protected]>
Date:   Wed Nov 29 00:16:45 2023 -0300

    TST: Simple refactoring

    While studying some of the tests that were written, I made some simple changes to conftest.py, test_function.py and test_solidmotor.py.

commit 04b751d
Author: MateusStano <[email protected]>
Date:   Fri Nov 17 19:08:21 2023 +0100

    BUG: fix time_array assignment in Environment class

commit 1dd5e1e
Author: MateusStano <[email protected]>
Date:   Fri Nov 17 19:08:09 2023 +0100

    ENH refactor get_instance_attributes function to
    filter out methods and protected attributes

commit 931f330
Author: MateusStano <[email protected]>
Date:   Fri Nov 17 16:16:09 2023 +0100

    MNT: add deprecation warnings

commit 2368cab
Author: MateusStano <[email protected]>
Date:   Fri Nov 17 16:15:56 2023 +0100

    ENH: add get attributes function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request, including adjustments in current codes
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

MNT: Extract logic from info in rocket class
4 participants